Skip to content

fix windows conda based detection - #653

Merged
popescu-v merged 1 commit into
mainfrom
fix-windows-conda-based-detection
Nov 24, 2026
Merged

popescu-v merged 1 commit into
mainfrom
fix-windows-conda-based-detection

Conversation

@lucaurelien

@lucaurelien lucaurelien commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Summary
Fix detection of non-activated Windows Conda installations using the new conda-forge Python 3.15 package layout.

Scope and implementation

  • Support both Windows layouts: Lib/site-packages and lib/python/site-packages.
  • Infer the environment root from the installed package path, using case-insensitive layout matching rather than Python-version checks.
  • Explicitly import importlib.util to prevent import-order-dependent failures in system-wide Pip detection.
  • Preserve existing activated Conda precedence, filesystem validation, Pip/Uv detection, Linux/macOS behavior, and runner environment isolation.
  • Replace duplicated shell-based CI cleanup with a shared Python helper that launches checks without Conda activation variables or environment-local PATH entries.

Validation
Add focused regression tests covering root inference, installation classification, environment-script selection and errors, environment isolation, and fresh-process Pip fallback.

All nine focused tests pass locally on macOS. Native Windows acceptance against an installed candidate, including sample and MPI checks, remains pending.

@popescu-v
popescu-v requested a review from tramora November 19, 2026 14:48
@popescu-v
popescu-v marked this pull request as ready for review November 19, 2026 14:49
@popescu-v popescu-v linked an issue Nov 19, 2026 that may be closed by this pull request

@tramora tramora left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems then that python3.15 under conda introduced an unexpected "python" parent in the folders hierarchy.
The PR looks good to me.
The automated test covers thoroughly the cases

@popescu-v
popescu-v force-pushed the fix-windows-conda-based-detection branch from 3ee59fe to 6dde084 Compare November 20, 2026 10:59
@popescu-v

Copy link
Copy Markdown
Collaborator

The real Conda package tests on the 11.0.2.1a.0 alpha version succeed on all target platforms: https://github.com/KhiopsML/khiops-python/actions/runs/44720092363. This validates the PR; hence, it can be merged.

@popescu-v
popescu-v force-pushed the fix-windows-conda-based-detection branch from 31ad9a8 to 79e46b8 Compare November 23, 2026 12:29
Previous implementations were OS-dependent and brittle, requiring
periodic maintenance according to Python and / or Conda ecosystem
evolutions, as shown by issue #649.

The implementation proposed in this commit only assumes that either
"site-packages" or "dist-packages" must be present on the Khiops runner
module's path, and that "Lib" or "lib" are also present on this path,
before "site-packages" or "dist-packages". Then, the environment path is
the directory one level above "Lib" or "lib".

Also add tests for conda-based installations, on Windows and Linux / macOS:
- test that the base directory is correctly inferred when not in a genuine
  Conda environment (no `CONDA_PREFIX`) is defined;
- test that the conda-based installation is correctly detected, on Windows
  and Linux / macOS (POSIX paths), thus tackling issue #649.

closes #649

Co-authored-by: Luc-Aurélien <133773992+lucaurelien@users.noreply.github.com>
@popescu-v
popescu-v force-pushed the fix-windows-conda-based-detection branch from 79e46b8 to cefa220 Compare November 24, 2026 12:04
@popescu-v
popescu-v merged commit 7c38ce0 into main Nov 24, 2026
9 checks passed
@popescu-v
popescu-v deleted the fix-windows-conda-based-detection branch November 24, 2026 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Conda-Based Environments Are Not Detected on Windows and Python 3.15

3 participants